package Test3;

import Test2.Point;
import Test2.Circle;

public class ColorCircle extends Circle {
    private Color borderColor;
    private Color centerColor;

    public ColorCircle() {
        super(0, 0, 0);
        this.borderColor = new Color(0, 0, 0);
        this.centerColor = new Color(0, 0, 0);
    }

    public ColorCircle(Point center, int radius) {
        super(center, radius);
        this.borderColor = new Color(0, 0, 0);
        this.centerColor = new Color(0, 0, 0);
    }

    public ColorCircle(Point center, int radius, Color centerColor, Color boardColor) {
        super(center, radius);
        this.setCenterColor(centerColor);
        this.setBorderColor(boardColor);
    }

    public Color getBorderColor() {
        return borderColor;
    }

    public void setBorderColor(Color borderColor) {
        this.borderColor = borderColor;
    }

    public Color getCenterColor() {
        return centerColor;
    }

    public void setCenterColor(Color centerColor) {
        this.centerColor = centerColor;
    }

    @Override
    public int relation(Circle c) {
        int flag = 0;
        if (c instanceof ColorCircle) {
            ColorCircle ct = (ColorCircle) c;
            //判断颜色是否相同
            if (ct.borderColor.getG() == this.borderColor.getG() &&
                    ct.borderColor.getR() == this.borderColor.getR() &&
                    ct.borderColor.getB() == this.borderColor.getB() &&
                    ct.centerColor.getG() == this.centerColor.getG() &&
                    ct.centerColor.getR() == this.centerColor.getR() &&
                    ct.centerColor.getB() == this.centerColor.getB()) {
                flag = 1;
            }
        }
        int result = super.relation(c);
        //颜色相同的什么类型的圆
        if (flag == 1) {
            return result;
        } else {
            return 0;
        }
    }
}
